find_package(Perl)
if (NOT PERL_FOUND)
  message(FATAL_ERROR "Currently perl is required.")
endif (NOT PERL_FOUND)

# prefixes.c
add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/prefixes.c
  COMMAND ${PERL_EXECUTABLE} -w -I${CMAKE_CURRENT_SOURCE_DIR}/../scripts ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/genprefixes.pl > ${CMAKE_CURRENT_BINARY_DIR}/prefixes.c
  )

# libhspell.{so,dylib}
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library (libhspell SHARED dict_radix.c gimatria.c corlist.c libhspell.c ${CMAKE_CURRENT_BINARY_DIR}/prefixes.c)
set_target_properties (libhspell PROPERTIES VERSION 0.2.0 SOVERSION 0 LIBRARY_OUTPUT_NAME hspell)

# hspell
add_executable (hspell hspell.c tclHash.c)
target_link_libraries (hspell libhspell)    

# hebrew.wgz
add_executable (find_sizes find_sizes.c dict_radix.c)
